package com.eduction.modules.system.dao;

import java.sql.SQLException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.eduction.common.dbutil.DbHelper;
import com.eduction.modules.system.entity.OrgUserEntity;

@Repository
public class OrgUserRepository {

	@Autowired
	private DbHelper dbHelper;
	@Autowired
	private OrgUserDao orgUserDao;
	
	/**
	 * 根据账号查询管理员信息
	 * @param account
	 * @return
	 * @throws SQLException
	 */
	public OrgUserEntity getAuthOrgUserByAccount(String account,String type) throws SQLException{
		String sql = "select p_id as p_id,s_user_account as s_user_account,s_password as s_password ,s_create_time as s_create_time ,s_type as s_type FROM t_org_user WHERE s_user_account = ? and s_type = ?";
		OrgUserEntity aou = dbHelper.getBean(sql, OrgUserEntity.class, account,type);
		return aou;
	}
	
	/**
	 * 保存管理员信息
	 * @param a
	 */
	public void saveAuthOrgUserInfo(OrgUserEntity a){
		orgUserDao.save(a);
	}
}
